@extends('home.layout.base')
<link rel="stylesheet" href="{{URL::asset('./css/hrmy/public.css')}}">

@section('content')
<div class="mainHrContent" id="hrSafeWx">
    <div class="storelistTitle" id="storelistTitle"  v-cloak>
        <span class="storelistTitle_left">
            <span>
                <img src="{{URL::asset('./img/icon/home.png')}}">
            </span>
            <span><a href="{{route('home.index.index') }}">首页</a> >
                <a href="{{route('home.suppliermy.supplierIndex') }}">供应商中心</a>
                > 安全中心
            </span>
        </span>
        <!-- <span class="storelistTitle_right">
            <span>找不到合适的供应商？发个需求试试？</span>
            <button @click="window.location.href ='{{ route('home.demand.demandAdd')}}'">免费发布需求</button>
        </span> -->
    </div>
    <div class="hrContent">
        @include('home.suppliermy.menu')
        <div class="basicInfo" id="hrSafeWxs"  v-cloak>
            <div class="basicInfo_title">
                <span></span>
                安全中心 > 微信绑定
            </div>
            <div class="qqWexin bindFalse" v-if="!is_wechat">
                <img class="codeQRwx" src="{{URL::asset('./img/icon/codeQr.png')}}">
                <span>请使用微信“扫一扫”扫描二维码进行授权绑定</span>
            </div>
            <div class="qqWexin bindTrue" v-else>
                <img src="{{URL::asset('./img/icon/safeWx.png')}}">
                <span>已成功绑定微信</span>
                <button @click="unBind">解除绑定</button>
            </div>
        </div>
    </div>
</div>
@endsection
@section('compontentScipts')
<script>
    $(() => {
        let hrSafeWx = new Vue({
            el: '#hrSafeWxs',
            data: () => {
                return {
                    is_wechat:0
                }
            },
            created() {
                this.is_wechat = JSON.parse(sessionStorage.getItem("HRuserDetails")).is_wechat;
            },
            mounted() {},
            methods: {
                unBind(){
                    apiAjax("{{ route('home.user.userUnbindApi')}}", 'post', {type:1}, (res) => {
                        if (res.code == 0) {
                            this.$message({
                                message: '解绑成功',
                                type: 'success'
                            });
                            window.location.href = "{{ route('home.suppliermy.supplierIndex') }}";
                        } else {
                            this.$message({
                                message: res.msg,
                                type: 'warning'
                            });
                        }
                    }, (erro) => {

                    });
                }
            }
        })
    })
</script>
@endsection